package com.dhcc.bpm.business.papc.service.impl;

//import com.baomidou.dynamic.datasource.annotation.DS;
import com.dhcc.bpm.business.papc.entity.ComParm;
import com.dhcc.bpm.business.papc.vo.ComParmVO;
import com.dhcc.bpm.business.papc.mapper.ComParmMapper;
import com.dhcc.bpm.business.papc.service.IComParmService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.util.StringUtils;
import java.util.List;

/**
 * 中间业务系统参数表  服务实现类
 *
 * @author liuzhao
 * @since 2020-05-15
 */
@Service
//@DS("slave")
public class ComParmServiceImpl extends BaseServiceImpl<ComParmMapper, ComParm> implements IComParmService {

    @Override
    public IPage<ComParmVO> selectComParmPage(IPage<ComParmVO> page, ComParmVO comParm) {
        return page.setRecords(baseMapper.selectComParmPage(page, comParm));
    }

    @Override
    public ComParm selectComParmById(Long id) {
        return baseMapper.selectComParmById(id);
    }

    @Override
    public boolean saveOrUpdate(ComParm comParm) {
        int result;
        if (StringUtils.isEmpty(comParm.getId())) {
            result = baseMapper.save(comParm);
        } else {
            comParm.setComParmKey(comParm.getId().toString());
            result = baseMapper.update(comParm);
        }
        return result >= 1;
    }

    @Override
    public boolean deleteComParmByIds(String ids) {
        int result = baseMapper.deleteComParmByIds(ids.split(","));
        return result >= 1;
    }

    @Override
    public List<ComParm> selectComParmAll(ComParm comParm) {
        return baseMapper.selectComParmAll(comParm);
    }

}
